import {createRouter, createWebHistory} from 'vue-router'
import Home from "@/views/Home.vue";
import ListPage from "@/views/ListPage.vue";
import GoodsDetail from "@/views/GoodsDetail.vue";
import Login from "@/views/Login.vue";

const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home
    },
    {
        path: '/ListPage',
        name: 'ListPage',
        component: ListPage
    },
    {
        path: '/GoodsDetail',
        name: 'GoodsDetail',
        component: GoodsDetail
    },
    {
        path: '/Login',
        name: 'Login',
        component: Login
    },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
}
)
// 设置用户：
// this.$store.dispatch('setUser', { id: 1, name: '张三' })
// 获取用户信息
// computed: {
//     user() {
//         return this.$store.getters.user
//     },
//     isLoggedIn() {
//      判断用户是否存在   return this.$store.getters.isLoggedIn
//     }


export default router
